package com.someclip.component.controlls
{
	import com.someclip.component.core.Component;
	import com.someclip.component.interfaces.ITextInput;
	import flash.events.KeyboardEvent;
	import flash.text.TextFieldType;
	import com.someclip.component.skins.DefaultFlatSkin;

	/**
	 * ...
	 * @author Argus
	 */
	public class TextInput extends Component implements ITextInput
	{
		private var _inputIns:Label;

		public function TextInput()
		{
			this.width=100;
			this.height=20;
			this.styleLink=new DefaultFlatSkin();
			_inputIns=new Label();
			_inputIns.text="input";
			_inputIns.selectAble=true;
			_inputIns.width=this.width - 2;
			_inputIns.height=this.height;
			_inputIns.textAlign="left";
			_inputIns.left=1;
			_inputIns.hCenter=0;
			_inputIns.vCenter=0;
			_inputIns.type=TextFieldType.INPUT;
			addChild(_inputIns);
		}

		override public function set width(value:Number):void
		{
			super.width=value;
			if (_inputIns)
				_inputIns.width=this.width - 2;
		}

		override public function set height(value:Number):void
		{
			super.height=value;
//			if (_inputIns)
//				_inputIns.height=this.height;
		}


		/**
		 * 获取文本内容
		 * @return
		 *
		 */
		public function get text():String
		{
			return _inputIns.text;
		}

		/**
		 * 设置文本内容
		 * @param value 字符串
		 *
		 */
		public function set text(value:String):void
		{
			_inputIns.text=value;
		}

		/**
		 * 获取字体大小
		 * @return
		 *
		 */
		public function get fontSize():uint
		{
			return _inputIns.fontSize;
		}

		/**
		 * 设置字体大小
		 * @param value
		 *
		 */
		public function set fontSize(value:uint):void
		{
			_inputIns.fontSize=value;

		}

		/**
		 * 获取字体加粗
		 * @return 布尔值
		 *
		 */
		public function get fontWeight():Boolean
		{
			return _inputIns.fontWeight;
		}

		/**
		 * 设置字体加粗
		 * @param value Boolean
		 *
		 */
		public function set fontWeight(value:Boolean):void
		{
			_inputIns.fontWeight=value;
		}

		/**
		 * 获取字体颜色
		 * @return
		 *
		 */
		public function get fontColor():uint
		{
			return _inputIns.fontColor;
		}

		/**
		 * 设置字体颜色
		 * @param value
		 *
		 */
		public function set fontColor(value:uint):void
		{
			_inputIns.fontColor=value;
		}

		/**
		 * 获取文本对齐方式
		 * @return
		 *
		 */
		public function get textAlign():String
		{
			return _inputIns.textAlign;
		}

		/**
		 * 设置文本对齐方式
		 * @param value
		 *
		 */
		public function set textAlign(value:String):void
		{
			_inputIns.textAlign=value;
		}

		public function get displayAsPassword():Boolean
		{
			return _inputIns.displayAsPassword;
		}

		public function set displayAsPassword(value:Boolean):void
		{
			_inputIns.displayAsPassword=value;
		}
	}

}
